"""
继承：对类进行修改和拓展
class 类名（父类名）：
    类内容体

继承：单继承和多继承
pass:可以不写对应要书写的代码
多继承：对于同名的成员，谁最先继承谁的属性优先被继承


"""


class Phone:
    IMEI = "huawei"  # 序列号

    def call_by3G(self):
        print("引领3G生活")


# 单继承
class Phone_2022(Phone):
    face_id = 1001  # 新功能

    def call_by5G(self):
        print("5G改变世界！")


phone = Phone_2022()
print(phone.IMEI)
phone.call_by3G()
phone.call_by5G()


# 多继承
class NFC:
    nfc_type = "第5代"
    producer = "huawei"

    def read_card(self):
        print("NFC读卡")

    def write_card(self):
        print("NFC写卡")


class RemoteControl:
    rc_type = "红外遥控器"
    producer = "xiaomi"

    def control(self):
        print("远程红外遥控")


# 自定义多继承类
class MyPhone(Phone, NFC, RemoteControl):
    pass


# 多继承对象
myphone = MyPhone()
print("myphone", myphone.IMEI)
myphone.call_by3G()
myphone.read_card()
myphone.control()

# 对于同名的成员，谁最先继承谁的属性优先被继承
print(myphone.producer)  # huawei
